/*
 * \brief  Capability allocation service
 * \author Norman Feske
 * \date   2006-06-26
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _CORE__INCLUDE__CAP_SESSION_COMPONENT_H_
#define _CORE__INCLUDE__CAP_SESSION_COMPONENT_H_

#include <cap_session/server.h>
#include <base/lock.h>

namespace Genode {

	class Cap_session_component : public Cap_session_server
	{
		private:

			static long _unique_id_cnt;
			static Lock _lock;

		public:

			Capability alloc(Capability ep)
			{
				Lock::Guard lock_guard(_lock);

				return Capability(ep.tid(), ++_unique_id_cnt);
			}

			void free(Capability cap) { }
	};
}

#endif /* _CORE__INCLUDE__CAP_SESSION_COMPONENT_H_ */
